<template>
  <router-view></router-view>
  <van-action-sheet :show="user.showOverlay" description="请选择发布类型" :actions="actions" cancel-text="取消"
    close-on-click-action close-on-click-overlay @cancel="setShowOverlay(false)" @select="setPublishType" />
  <realnameAuthoritarian></realnameAuthoritarian>
  <tab-bar v-show="router.meta.needTab"></tab-bar>
</template>
<script setup lang='ts'>
import { userStore } from '@/store';
import { actions } from '@/common/commonMap'
import tabBar from './components/tabBar.vue'
import { useRoute } from 'vue-router';
import realnameAuthoritarian from '@/components/realnameAuthoritarian.vue'
const router = useRoute()
import routes from '@/router/index';
import { showConfirmDialog } from 'vant';

const user = userStore()
const setShowOverlay = (show: boolean) => {
  user.setShowOverlay(show)
}

const setPublishType = (e: any) => {
  if (e.type == 'pet' && !user.userInfo.realname && !user.userInfo.idNo) {
    showConfirmDialog({
      title: '提示',
      message:
        '您还未进行实名认证，请先点击确定进行实名认证！',
    })
      .then(() => {
        user.setRealShow(true)
        
      })
      .catch(() => {
        
      });
      return
  }
  user.setpostsType(e.type)
  routes.push({ name: 'publish' })
  user.setShowOverlay(false)
}


</script>

<style lang='less' scoped>
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.block {
  width: 120px;
  height: 120px;
  background-color: #fff;
}
</style>
